/*
 * Copyright 2024 Hangzhou Yingyi Technology Co., Ltd
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __RASPI_GPIO_H__
#define __RASPI_GPIO_H__

#include <stdint.h>
#include <stddef.h>

/*GPIO  Register offset*/
#define GPFSEL0         0x0
#define GPFSEL1         0x04
#define GPFSEL2         0x08
#define GPFSEL3         0x0C
#define GPFSEL4         0x10
#define GPFSEL5         0x14
#define GPSET0          0x1C
#define GPSET1          0x20
#define GPCLR0          0x28
#define GPLEV0          0x34
#define GPLEV1          0x38
#define GPEDS0          0x40
#define GPEDS1          0x44
#define GPHEN0          0x64
#define GPHEN1          0x68
#define GPPUD           0x94
#define GPPUDCLK0       0x98
#define GPPUDCLK1       0x9C

void _libraspiplat_init_gpio(void *fdtp);

/**
 * @brief map uart0 to gpio14/15
 *
 * @return -1: gpio not initialized, mapping error
 *          0: mapping success
 */
int map_uart_to_gpio(void);
#endif /* __RASPI_GPIO_H__ */
